package com.panda.springcloud.controller;/**
 * @author 乐于吕
 * * @date 2024/10/23
 */

import com.panda.springcloud.entity.Student;
import com.panda.springcloud.form.StudentForm;
import com.panda.springcloud.service.StudentService;
import com.panda.springcloud.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *@Author: 乐于吕
 *@CreateTime: 2024-10-23
 *@Description:
 */

@RestController
@RequestMapping("students")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @GetMapping
    public List<StudentVO> studentList(){

        return studentService.studentList();
    }


    @PostMapping
    public StudentVO addStudent(@RequestBody StudentForm studentForm){

        return studentService.addStudent(studentForm);
    }
}